The Prophet ﷺ forbade us from facing the qiblah while urinating, yet I saw him a year before he passed away facing it.
حدثنا محمد بن بشار ومحمد بن المثنى قالا حدثنا وهب بن جرير حدثنا أبي عن محمد بن إسحق عن أبان بن صالح عن مجاهد
نهى النبي ﷺ أن نستقبل القبلة ببول فرأيته قبل أن يقبض بعام يستقبلها
[Hasan] Abu Dawud narrated it in Kitab al-Tahara, Bab al-Rukhsa fi Dhalik, no. 13, and Ibn Majah, no. 325, both from Muhammad bin Bashshar, and Ibn Ishaq stated explicitly that he heard it directly, from Ahmad, 3/360. Ibn Khuzayma graded the hadith sahih, 1/34, as did Ibn Hibban (Mawarid), 134, Ibn Jarud, no. 31, Hakim, 1/154, Dhahabi, and others.On this subject there are also narrations from Abu Qatada [coming after this, no. 10], Ayesha [Ibn Majah, no. 324], and Ammar bin Yasir [Ibn Adi in al-Kamil, 2/560, and Tabarani in al-Kabir].