When an unbeliever dies, then is no harm in saying:
إِنَّا لِلَّهِ وَإِنَّـا إِلَيْهِ رَاجِعونَ
“Innā lillāhi wa innā ilaihi rāji’ūn.” Translation: “Verily, we belong to Allāh and unto Him we are returning.” If the person was your relative etc, then there is no harm in saying these words. That is because everyone returns to Allah and everyone belongs to Allah, He owns all people. However, it is not allowed to supplicate for the unbeliever, and to seek forgiveness for him― so long as he was a non-Muslim (kāfir) and died as such, then supplication for forgiveness is not made for him because those who died whilst disbelieving in Allah, His Revelation (the Quran) and in the Messenger of Allah will not be forgiven.
Whilst they are alive, of course, we supplicate for their guidance― that they may be guided to the worship of Allah alone and to the Sunnah, just as the Prophet (ﷺ) supplicated for many unbelievers and pagans, and through that Allah guided them― and the grant of guidance of the hearts is with Allah.
There is no harm if the Muslims console their fellow Muslim whose non-Muslim relative dies with the words:
أَعْظَـمَ اللَّهُ أَجْـرَكَ، وَأَحْسَـنَ عَـزَاءَكَ
“A’dhamallāhu ajrak, wa ahsana ‘azā-ak.“ Translation: “May Allah magnify your reward and make perfect your bereavement.” There is no harm in this because the deceased may have been of benefit to you while he was alive, and maybe he treated you well. However, you are not to supplicate for the unbeliever (kāfir) after his death and you are not to seek forgiveness for him or give charity on his behalf because all of this is forbidden in the texts of the Quran and Hadīth.
Based on a fatwa of Shaikh Ibn Bāz: https://binbaz.org.sa