If you are thinking of it as a 3d grid, you might just have a (Map (Integer, Integer, Integer) Contents, where every room in this 3d grid that has something in it is in the map and every room that is empty space has no corresponding entry in the map.
Then when you enter a room you can quickly look up what is in that room, then reasonably quickly check the neighbors in every direction to see what the ship might be able to sense were it to travel in that direction.
In this case, space is infinite, but the datastructure is only as big as the amount of content you have.