Abdullah bin Umar reported,

When Abdullah bin Ubayy died, his son came to the Prophet ﷺ and said, "Give me your shirt so I may shroud him in it, pray over him, and seek forgiveness for him."So he gave him his shirt and said, "When you are finished, let me know so I may pray over him."Umar pulled at him and said, "Allah has forbidden you to pray over the hypocrites."He replied, "I have been given a choice. Allah said, 'Ask forgiveness for them or do not ask forgiveness for them.'"So he prayed over him. Then Allah the Exalted revealed, "And never pray over any of them who has died, nor stand at his grave" [Tawbah 9:84]. So he stopped praying over them.

Nasai 1901

Sahih

أخبرنا عمرو بن علي قال حدثنا يحيى قال حدثنا عبيد الله قال حدثنا نافع

عن عبد الله بن عمر قال

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

النسائي 1901صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Nasai Sughra
Book
Funerals
Chapter
Shirt in the shroud
Numbering
Darussalam 1901
Nasai 1901