It was narrated from Bilal bin Al-Harith Al-Muzani that:
When the Messenger of Allah wanted to relieve himself, he would go far away.
English reference: Vol. 1, Book 1, Hadith 336
Arabic reference: Book 1, Hadith 360
Read hadith from the major collections in the app, with prayer times and a Qibla compass. Free.