Jami` at-Tirmidhi, Volume 5, Book 44, Hadith 3098 (DarusSalam)

Narrated Ibn 'Umar: "'Abdullah bin 'Abdullah bin Ubayy came to the Messenger of Allah when his father died, and said: 'Give me your shirt to shroud him in and perform the Salat upon him, and seek forgiveness for him.' So he gave him his shirt, and said: 'When you are finished then inform me.' So when he wanted to perform the Salat, 'Umar tugged at him and said: 'Has not Allah prohibited that you perform Salat over the hypocrites?' He said: 'I have been given the choice between two: 'Whether you seek forgiveness for them or you do not seek forgiveness for them.... (9:80)' So he performed the Salat for him. Then Allah revealed: 'And never pray for any of them who dies, nor stand at his grave... (9:84)' So he abandoned praying for them."

حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ، حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ، حَدَّثَنَا عُبَيْدُ اللَّهِ، أَخْبَرَنَا نَافِعٌ، عَنِ ابْنِ عُمَرَ، قَالَ جَاءَ عَبْدُ اللَّهِ بْنُ عَبْدِ اللَّهِ بْنِ أُبَىٍّ إِلَى النَّبِيِّ صلى الله عليه وسلم حِينَ مَاتَ أَبُوهُ فَقَالَ أَعْطِنِي قَمِيصَكَ أُكَفِّنْهُ فِيهِ وَصَلِّ عَلَيْهِ وَاسْتَغْفِرْ لَهُ ‏.‏ فَأَعْطَاهُ قَمِيصَهُ وَقَالَ ‏"‏ إِذَا فَرَغْتُمْ فَآذِنُونِي ‏"‏ ‏.‏ فَلَمَّا أَرَادَ أَنْ يُصَلِّيَ جَذَبَهُ عُمَرُ وَقَالَ أَلَيْسَ قَدْ نَهَى اللَّهُ أَنْ تُصَلِّيَ عَلَى الْمُنَافِقِينَ فَقَالَ ‏"‏ أَنَا بَيْنَ خِيرَتَيْنِ ‏:‏ ‏(‏اسْتَغْفِرْ لَهُمْ أَوْ لاَ تَسْتَغْفِرْ لَهُمْ ‏)‏ ‏"‏ ‏.‏ فَصَلَّى عَلَيْهِ فَأَنْزَلَ اللَّهُ‏:‏ ‏(‏وَلَا تُصَلِّ عَلَى أَحَدٍ مِنْهُمْ مَاتَ أَبَدًا وَلاَ تَقُمْ عَلَى قَبْرِهِ ‏)‏ فَتَرَكَ الصَّلاَةَ عَلَيْهِمْ ‏.‏ قَالَ أَبُو عِيسَى هَذَا حَدِيثٌ حَسَنٌ صَحِيحٌ ‏.‏

sunnah.com