All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
According to the sound opinion of scholars concerning al-Khidr, we state that he is a Prophet. This is based on many proofs.
Allah Says (what means): {…And I did it not of my own accord.} [Quran 18: 82]
Also, al-Khidr and all Prophets, may Allaah exalt their mention, are alive in their graves. Al-Mundhiri reported that the Prophet said: “Prophets are alive in their graves.” [Al-Bayhaqi classified this Hadeeth as sound]
Besides, Anas narrated that the Prophet said: “I passed by Moosa (Moses) on the night of Israa’ (and al-Mi'raaj) at the red dune and he was praying in his grave." [Muslim]
This life in the grave is called the life of Barzakh, which is different from the worldly life. Prophets in such a state hear the greetings [i.e. the saying of Assalamu Alaykum] of those who pass by their graves as long as they are near them. As for the Prophet Muhammad it is proved that he said: “Indeed Allah has angels who roam the earth and they convey to me the greetings (or blessings and peace) of my Ummah (nation).” [Ahmad and Abu Dawood, from Ibn Mas'ood]
But, according to our knowledge, other Prophets do not have this characteristic.
As for the martyrs, they are alive as stated in the Quran. Allah Says (what means): {And never think of those who have been killed in the cause of Allah as dead. Rather, they are alive with their Lord, receiving provision.} [Quran 3:169]
Also, all the believing dead people may hear the greetings and invocations (blessings and peace) of the live Muslim people who visit them to supplicate to Allah to forgive them or to send His Mercy upon them. This is the correct opinion in this concern; i.e., (the hearing of the dead).
Regarding those who believe that Prophets and martyrs or other dead people are alive in this present life, then they are completely wrong, and this belief is false and contradicts the Quran and Sunnah and the agreement of Muslim scholars.
Therefore, one who holds such belief is, in fact, in a very dangerous situation, unless he/she lives in a desert or he/she is a new Muslim. We are to teach him the sound creed.
For more benefit on the life in Al-Barzakh (the interval period between death and resurrection), please refer to Fatawa 10565, 83719, 16778, 17286, 48844 and 84517.
Allah knows best.