Musayab bin Hazn reported,

When death approached Abu Talib, the Prophet ﷺ entered upon him while Abu Jahl and Abdullah bin Abu Umaya were present. The Prophet ﷺ said, "Uncle, say 'There is no god but Allah,' a statement by which I may plead on your behalf before Allah."Abu Jahl and Abdullah bin Abu Umaya said, "Abu Talib, are you turning away from the religion of Abdul-Muttalib?"The Prophet ﷺ said, "I will surely seek forgiveness for you so long as I am not forbidden to do so."Then was revealed, "It is not for the Prophet and those who have believed to ask forgiveness for the polytheists, even if they were relatives, after it has become clear to them that they are companions of Hellfire." [Tawbah 9:113]

Bukhari 4675

Sahih

حدثنا إسحاق بن إبراهيم حدثنا عبد الرزاق أخبرنا معمر عن الزهري

عن سعيد بن المسيب عن أبيه قال

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

البخاري 4675صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Tafsir
Chapter
His saying, "It was not for the Prophet and those who believed to seek forgiveness for the polytheists"
Numbering
Darussalam 4675
Bukhari 4675