Abu Dawud Book 1, Hadith Number 88.
Chapter : Can a man offer prayer while he is feeling the call of nature.
Narated By Abdullah ibn al-Arqam : Urwah reported on the authority of his father that Abdullah ibn al-Arqam travelled for performing hajj (pilgrimage) or umrah. He was accompanied by the people whom he led in prayer. One day when he was leading them in the dawn (fajr) prayer, he said to them: One of you should come forward. He then went away to relieve himself. He said: I heard the Messenger of Allah (PBUH) say: When any of you feels the need of relieving himself while the congregational prayer is ready, he should go to relieve himself.