It was narrated from Thawban that:
The Messenger of Allah said: "No one among the Muslims should stand to pray when he is suppressing (the need to urinate or defecate), until he has to relieve himself." (DE)
English reference (DE): Vol. 1, Book 1, Hadith 619 (DE)
Arabic reference (DE): Book 1, Hadith 662 (DE)