That's silly, if you're spending an entire day in a dungeon resting and sleeping then monsters should definitely be interrupting you and making it so you can't exploit the rules.
Rope Trick would allow for a long rest, pretty much anywhere. Level 2 wizard spell, though you would need to be a 9th level caster to use it in such a manner.
Duration is 1h, so your wizard would be burning a second level or higher spell slot every hour for 8 hours. They also wouldn't get the long rest presumably. Sure, you can do it, but it isn't sustainable.