Sahih Muslim Book 4, Hadith Number 1038.

Chapter : The excellence of the prayer and the way it is begun and the excellence of Ruku’ and moderation in it and prostration and moderation in it, etc.

Masruq reported: It was mentioned before ‘Aisha that prayer is invalidated (in case of passing) of a dog, an ass and a woman (before the worshipper, when he is not screened). Upon this ‘Aisha said: You likened us to the asses and the dogs. By Allah I saw the Messenger of Allah (may peace be upon him) saying prayer while I lay on the bedstead interposing between him and the Qibla. When I felt the need, I did not like to wit to front (of the Holy Prophet) and perturb the Messenger of Allah (may peace be upon him) and quietly moved out from under its (i.e. of the bedstead) legs.