Praying for forgiveness for the mushrikeen is undoubtedly haraam, as is indicated by the Qur’aan and Sunnah.
Allaah says (interpretation of the meaning):
“It is not (proper) for the Prophet and those who believe to ask Allaah’s forgiveness for the Mushrikoon, even though they be of kin, after it has become clear to them that they are the dwellers of the Fire (because they died in a state of disbelief).
And Ibraaheem’s (Abraham) invoking (of Allaah) for his father’s forgiveness was only because of a promise he [Ibraaheem (Abraham)] had made to him (his father). But when it became clear to him that he (his father) is an enemy of Allaah, he dissociated himself from him. Verily, Ibraaheem was Awwah (one who invokes Allaah with humility, glorifies Him and remembers Him much) and was forbearing”
[al-Tawbah 9:113-114]
al-Sa’di (may Allaah have mercy on him) said:
This means, it is not appropriate or good for the Prophet and those who believe in him to “ask Allaah’s forgiveness for the mushrikeen”, i.e. for those who disbelieve in Him and worship others alongside Him. “even though they be of kin, after it has become clear to them that they are the dwellers of the Fire”
…
Al-Bukhaari (3884) narrated that the Prophet (peace and blessings of Allaah be upon him) called his paternal uncle Abu Taalib to Islam when he was dying, and the Prophet (peace and blessings of Allaah be upon him) said: “I will pray for forgiveness for you so long as I am not forbidden to do so.” Then the following verses were revealed (interpretation of the meaning):
“It is not (proper) for the Prophet and those who believe to ask Allaah’s forgiveness for the Mushrikoon, even though they be of kin, after it has become clear to them that they are the dwellers of the Fire (because they died in a state of disbelief).”
[al-Tawbah 9:113]
“Verily, you (O Muhammad) guide not whom you like”
[al-Qasas 28:56]
Al-Haafiz said:
“So long as I am not forbidden to do so” means, so long as I am not forbidden to pray for forgiveness.
Muslim (976) narrated that Abu Hurayrah said: The Messenger of Allaah (peace and blessings of Allaah be upon him) said: “I asked my Lord for permission to pray for forgiveness for my mother, and He did not give me permission. I asked Him for permission to visit her grave, and He granted me permission.”
Al-Nawawi (may Allaah have mercy on him) said:
This indicates that it is forbidden to pray for forgiveness for the kuffaar.
It is clear from these two ahaadeeth that this prohibition applies to praying for forgiveness for them. The same applies to praying for them to be admitted to Paradise and saved from torment.
The reason for this prohibition is:
“That seeking forgiveness for them in this case (i.e., when it is clear that they are dwellers of the Fire) is a mistake and is of no use, so it is not befitting for the Prophet and the believers to do this, because if they (the mushrikeen) have died in shirk or it is known that they will die in shirk, then the word of punishment has been fulfilled against them and they will abide forever in Hell, and the intercession of those who intercede and the prayers of forgiveness of those who pray will be to no avail.
…
But praying for the kaafirs to be guided is not included in the prohibition on praying for forgiveness for them.
It is proven that the Prophet (peace and blessings of Allaah be upon him) prayed for some of the kuffaar to be guided.