When we visit the grave of prophet (sws) we say assalaamu alaykum yā ayyuhā al-Nabi (Peace be upon you O Prophet (sws) as if he is alive or in front of us. My question is what we can say when visiting the graves of other pious people called awliya of Allah? Can we address them in a similar wording or we should say something like this as-salamu-alaikum ya ahl al-kubur (Peace be upon you O residents of the graves)? What about visiting the graveyard of the non-Muslims?
Saying 'oh Prophet" before the grave of the Prophet do not necessarily depict the speaker's belief of considering him alive. We in fact say these words to the persons dead or not present in our daily life to express certain feelings. We can and we do call the dead in this way. However, the belief of any prophets or saints being alive and listening to our conversation near or far from their graves is strictly polytheistic in its nature which will not be forgiven at any degree. We can also say as-salamu-alaikum ya ahl al-kubur before the graves of all the people irrespective of religion except for the graves of known polytheists. Offering slam is a prayer in its nature and the Almighty has strictly prohibited praying for those who professed and declared polytheism as their religion.