كتاب الطهارة
2
The Book of Purification
(30)
Chapter: The obligation to wash away urine and other impurities if they result in the Masjid, and the ground may be purified with water with no need to scrub it
(30)
باب وُجُوبِ غَسْلِ الْبَوْلِ وَغَيْرِهِ مِنَ النَّجَاسَاتِ إِذَا حَصُلَتْ فِي الْمَسْجِدِ وَأَنَّ الأَرْضَ تَطْهُرُ بِالْمَاءِ مِنْ غَيْرِ حَاجَةٍ إِلَى حَفْرِهَا

Anas b. Malik reported:

While we were in the mosque with Allah's Messenger (ﷺ), a desert Arab came and stood up and began to urinate in the mosque. The Companions of Allah's Messenger (ﷺ) said: Stop, stop, but the Messenger of Allah (ﷺ) said: Don't interrupt him; leave him alone. They left him alone, and when he finished urinating, Allah's Messenger (ﷺ) called him and said to him: These mosques are not the places meant for urine and filth, but are only for the remembrance of Allah, prayer and the recitation of the Qur'an, or Allah's Messenger said something like that. He (the narrator) said that he (the Holy Prophet) then gave orders to one of the people who brought a bucket of water and poured It over.
حَدَّثَنَا زُهَيْرُ بْنُ حَرْبٍ، حَدَّثَنَا عُمَرُ بْنُ يُونُسَ الْحَنَفِيُّ، حَدَّثَنَا عِكْرِمَةُ بْنُ عَمَّارٍ، حَدَّثَنَا إِسْحَاقُ بْنُ أَبِي طَلْحَةَ، حَدَّثَنِي أَنَسُ بْنُ مَالِكٍ، - وَهُوَ عَمُّ إِسْحَاقَ - قَالَ بَيْنَمَا نَحْنُ فِي الْمَسْجِدِ مَعَ رَسُولِ اللَّهِ صلى الله عليه وسلم إِذْ جَاءَ أَعْرَابِيٌّ فَقَامَ يَبُولُ فِي الْمَسْجِدِ فَقَالَ أَصْحَابُ رَسُولِ اللَّهِ صلى الله عليه وسلم مَهْ مَهْ ‏.‏ قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏"‏ لاَ تُزْرِمُوهُ دَعُوهُ ‏"‏ ‏.‏ فَتَرَكُوهُ حَتَّى بَالَ ‏.‏ ثُمَّ إِنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم دَعَاهُ فَقَالَ لَهُ ‏"‏ إِنَّ هَذِهِ الْمَسَاجِدَ لاَ تَصْلُحُ لِشَىْءٍ مِنْ هَذَا الْبَوْلِ وَلاَ الْقَذَرِ إِنَّمَا هِيَ لِذِكْرِ اللَّهِ عَزَّ وَجَلَّ وَالصَّلاَةِ وَقِرَاءَةِ الْقُرْآنِ ‏"‏ ‏.‏ أَوْ كَمَا قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏.‏ قَالَ فَأَمَرَ رَجُلاً مِنَ الْقَوْمِ فَجَاءَ بِدَلْوٍ مِنْ مَاءٍ فَشَنَّهُ عَلَيْهِ ‏.‏
Reference : Sahih Muslim 285
In-book reference : Book 2, Hadith 127
USC-MSA web (English) reference : Book 2, Hadith 559
  (deprecated numbering scheme)