(1) The Book of Purification
كتاب الطهارة
(7) Chapter: The Manners of Answering the Call of Nature
(7) باب قضاء الحاجة
Bulugh al-Maram 91 
Narrated Abu Huraira (rad):
Allah’s Messenger (ﷺ) said: “Safeguard yourselves from the two matters which cause accursing that befalls the one who relieves himself on people’s path-ways and under the shades.” [Reported by Muslim].
وَعَنْ أَبِي هُرَيْرَةَ ‏- رضى الله عنه ‏- قَالَ: قَالَ رَسُولُ اَللَّهِ ‏- صلى الله عليه وسلم ‏-{ اِتَّقُوا اَللَّاعِنِينَ: اَلَّذِي يَتَخَلَّى فِي طَرِيقِ اَلنَّاسِ, أَوْ فِي ظِلِّهِمْ } رَوَاهُ مُسْلِم ٌ 1‏ .‏


‏1 ‏- صحيح.‏ رواه مسلم (269)‏.‏

Reference : Bulugh al-Maram 91
In-book reference : Book 1, Hadith 109
English translation : Book 1, Hadith 97