Mishkat al-Masabih 355
Mu'adh reported God's messenger as saying, "Guard against the three things which produce cursing:
relieving oneself in watering-places, in the middle of the road, and in the shade.” 

Abu Dawud and Ibn Majah transmitted it.
وَعَنْ مُعَاذٍ قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: 
" اتَّقُوا الْمَلَاعِنَ الثَّلَاثَةَ: الْبَرَازَ فِي الْمَوَارِدِ وَقَارِعَةِ الطَّرِيقِ وَالظِّلِّ ". رَوَاهُ أَبُو دَاوُد وَابْن مَاجَه