This is not being asked for any pragmatic need. I had the thought about people living off of planets.
Without getting into the issue of whether a burial can take place anywhere beside Earth, I wonder; is there is a minimum of soil needed to be a suitable grave?
Justification for the question, on Earth, seems difficult. An area composed only of solid stone or some other impregnable stratum, perhaps. If you think the question is only ask-able off the Earth, raising other issues, I welcome that assumption be challenged.