Sahih Muslim , Hadith 2774

Ibn 'Umar reported that when 'Abdullah b. Ubayy b. Salul died. His son 'Abdullah b. 'Abdullah (b. Ubayy) came to Allah's Messenger and begged him that he should give him his shirt which he would use as a coffin for his father, he gave him that. He then begged that he should conduct funeral prayer for him. Allah's Messenger had hardly got up to observe the prayer for him that 'Umar stood up and caught hold of the garment of Allah's Messenger and said: Allah's Messenger, are you going to conduct prayer for this man, whereas Allah has forbidden you to offer prayer for him? Thereupon Allah's Messenger said: Allah has given me an option as He has said:" You may beg pardon for them or you may not beg pardon for them, and even if you beg pardon for them, seventy times" (ix. 80), and I am going to make an addition to the seventy. He was a hypocrite and Allah's Messenger offered prayer for him and Allah, the Exalted and Glorious, revealed this verse:" Do not offer prayer for any one of them at all and do not stand upon their graves for (offering prayer over them)" (ix. 84).

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

sunnah.com

This hadith has been narrated on the authority of 'Abdullah with the same chain of transmitters but with this addition: " He then abandoned offering (funeral) prayer for them."

حَدَّثَنَا مُحَمَّدُ بْنُ الْمُثَنَّى، وَعُبَيْدُ اللَّهِ بْنُ سَعِيدٍ، قَالاَ حَدَّثَنَا يَحْيَى، - وَهُوَ الْقَطَّانُ - عَنْ عُبَيْدِ اللَّهِ، بِهَذَا الإِسْنَادِ نَحْوَهُ وَزَادَ قَالَ فَتَرَكَ الصَّلاَةَ عَلَيْهِمْ ‏.‏

sunnah.com