كتاب الأمور المنهي عنها
17  
The Book of the Prohibited actions
(309)
Chapter: Prohibition of Spitting in the Mosque
(309)
- باب النهي عن البصاق في المسجد والأمر بإزالته منه إذا وجد فيه، والأمر بتنزيه المسجد عن الأقذار
Riyad as-Salihin 1695
Anas (May Allah be pleased with him) said:
The Messenger of Allah (ﷺ) said, "It is not proper to use the mosque for urinating or easing oneself. They are merely built for the remembrance of Allah and the recitation of the Qur'an", or as he stated.

[Muslim].

وعن أنس رضي الله عنه أن رسول الله صلى الله عليه وسلم قال‏:‏ ‏ "‏إن هذه المساجد لا تصلح لشيء من البول ولا القذر، إنما هي لذكر الله تعالى، وقراءة القرآن‏"‏ أو كما قال رسول الله صلى الله عليه وسلم ‏.‏ ‏(‏‏(‏رواه مسلم‏)‏‏)‏‏.‏
Reference : Riyad as-Salihin 1695
In-book reference : Book 17, Hadith 185