When Abdullah bin Ubayy died, his son came to the Messenger of Allah ﷺ and said, "Messenger of Allah, give me your shirt so that I may shroud him in it, and pray over him, and seek forgiveness for him."So he gave him his shirt and said, "Inform me when he is ready."When he was about to pray over him, Umar said, "Has Allah not forbidden you to pray over the hypocrites?"He replied, "I have been given a choice between two options, 'Ask forgiveness for them or do not ask forgiveness for them' [Tawbah 9:80]." Then he prayed over him.So Allah, the Exalted, revealed, "And never pray over any of them who has died" [Tawbah 9:84].He said, "So the prayer over them was abandoned."
حدثنا يحيى عن عبيد الله حدثني نافع
لما مات عبد الله بن أبي جاء ابنه إلى رسول الله ﷺ فقال يا رسول الله أعطني قميصك حتى أكفنه فيه وصل عليه واستغفر له فأعطاه قميصه وقال آذني به فلما ذهب ليصلي عليه قال يعني عمر قد نهاك الله أن تصلي على المنافقين فقال أنا بين خيرتين {استغفر لهم أو لا تستغفر لهم} فصلى عليه فأنزل الله تعالى {ولا تصل على أحد منهم مات أبدا} قال فتركت الصلاة عليهم
Its isnad is sahih. Ibn Kathir quoted it in his Tafsir, 4:217–218, from Bukhari, in similar wording, via Abu Usama, from Ubaydullah, from Nafi. Then he said, Muslim likewise narrated it from Abu Bakr bin Abu Shayba, from Abu Usama Hammad bin Usama, with the same chain. Bukhari also narrated it from Ibrahim bin Munzir, from Anas bin Iyad, from Ubaydullah, that is, Ibn Umar Umari, with the same chain. Imam Ahmad likewise narrated it from Yahya bin Saeed Qattan, from Ubaydullah, with the same chain, meaning this particular hadith. A similar version of it has already been given at greater length from the hadith of Umar bin Khattab himself, number 95.