Narrated Umar bin Al-Khattab:
When 'Abdullah bin Ubai bin Salul died, Allah's Apostle was called in order to offer the funeral prayer for him. When Allah's Apostle got up (to offer the prayer) I jumped towards him and said, "O Allah's Apostle! Do you offer the prayer for Ibn Ubai although he said so-and-so on such-and-such-a day?" I went on mentioning his sayings. Allah's Apostle smiled and said, "Keep away from me, O 'Umar!" But when I spoke too much to him, he said, "I have been given the choice, and I have chosen (this) ;
and if I knew that if I asked forgiveness for him more than seventy times, he would be for given, I would ask it for more times than that." So Allah's Apostle offered the funeral prayer for him and then left, but he did not stay long before the two Verses of Surat-Bara'a were revealed, i.e.:-- 'And never (O Muhammad) pray for anyone of them that dies.... and died in a state of rebellion.' (9.84) Later I was astonished at my daring to speak like that to Allah's Apostle and Allah and His Apostle know best.
Sahih al-Bukhari, Vol. 6, Book of Prophetic Commentary on the Qur'an, Hadith 193
Sahih al-Bukhari, Book of Prophetic Commentary on the Qur'an, Hadith 193