Sayyiduna Jubayr bin Mut'im (may Allah be pleased with him) reports this saying of the Prophet (peace and blessings be upon him): "Prescribed punishments are not to be carried out in mosques."
Al-Bazzar recorded it; its chain contains al-Waqidi, who is da'if (weak) because of his tadlis, but he has explicitly stated that he heard it, and he has also explicitly stated "he narrated to us".
Hadith Referenceمجمع الزوائد ومنبع الفوائد / كتاب الحدود والديات / 10700