It is not permissible to pray funeral prayer when the deceased is not present. This is the most authentic opinion of scholars. some scholars say that it is permissible only when the deceased had great influence and benefit to Islam. This is not the most authentic opinion.
As for the Najashi, scholars say that the Prophet salla Allahu alaihi wa sallam prayed on him because he died and no Muslims were in his country to offer funeral prayers.