What is the ruling of prostrating on, prostrating towards, or prostrating in the vicinity of a grave?
It is haram to prostrate in the direction of a grave unless there is a barrier in between delimiting the boundary (maqsura) of the grave; what lies outside that boundary is not part of the gravesite and is permissible to use as a place of prayer. It is kufr to prostrate towards a grave or on top of a grave intentionally whether there is a barrier or not. Prostrating in the vicinity of a grave has no bearing on the issue and is indifferent.
Hajj Gibril Haddad