Abdullah bin Umar reported,

When Abdullah bin Ubayy died, his son came to the Prophet ﷺ and said, "Messenger of Allah, give me your shirt so I may shroud him in it, pray over him, and ask forgiveness for him."The Prophet ﷺ gave him his shirt and said, "Inform me so I may pray over him."So he informed him. When the Prophet ﷺ was about to pray over him, Umar رضي الله عنه pulled him back and said, "Has Allah not forbidden you from praying over the hypocrites?"The Prophet ﷺ replied, "I have been given a choice between two options. Allah said, 'Ask forgiveness for them or do not ask forgiveness for them. Even if you ask forgiveness for them seventy times, Allah will never forgive them' [Tawbah 9:80]."Then he prayed over him, and the verse was revealed, "And never pray over any of them who has died, nor stand at his grave" [Tawbah 9:84].

Bukhari 1269

Sahih

حدثنا مسدد قال حدثنا يحيى بن سعيد عن عبيد الله قال حدثني نافع

عن ابن عمر رضي الله عنهما

أن عبد الله بن أبي لما توفي جاء ابنه إلى النبي ﷺ فقال يا رسول الله أعطني قميصك أكفنه فيه وصل عليه واستغفر له فأعطاه النبي ﷺ قميصه فقال آذني أصلي عليه فآذنه فلما أراد أن يصلي عليه جذبه عمر رضي الله عنه فقال أليس الله نهاك أن تصلي على المنافقين فقال أنا بين خيرتين قال {استغفر لهم أو لا تستغفر لهم إن تستغفر لهم سبعين مرة فلن يغفر الله لهم} فصلى عليه فنزلت {ولا تصل على أحد منهم مات أبدا ولا تقم على قبره}

البخاري 1269صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Funerals
Chapter
Shrouding in a shirt that has sleeves or does not have sleeves, and those who were shrouded without a shirt
Numbering
Darussalam 1269
Bukhari 1269