It is narrated from Abu Hurayrah (may Allah be pleased with him) that he (peace and blessings be upon him) said: "None of you should pray while he feels the need to relieve himself."
A group narrated it from Shu'bah with a connected chain to the Prophet, while Adam bin Abi Iyas narrated it from Shu'bah as mawquf (the words of the Companion).
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 5031