Trapped in an ocean Temple in Minecraft?

Solution 1:

Mining fatigue only slows your mining down, it doesn't completely prevent it. So you can for example bind your mining action to a key on your keyboard instead of a mouse button and put a weight on it, then go away for a few minutes while your character slooowly breaks the block.

Solution 2:

While making yourself mine a block forever isn't a bad solution, if you're looking for a much easier way to get out of this scenario, just go to your options and open to LAN with cheats enabled.

Then, you can either put yourself in creative and break a block, use /kill @s, or whatever feels fair to you.

Solution 3:

Mining Fatigue only slows mining but at level 3 it will take a VERY long time to break any blocks. What you could do is set the world to peaceful which will make the elder guardians permanently despawn. You can do this and still get achievements and such.

Solution 4:

Solutions with breaking blocks possibly are the simpliest ones, but there is an another way. It is to cause Minecraft regenerate the chunk.

The chunk you're at, erases all the changes you've made in it, and returns to its initial state like it was when the world was first generated. I personally used it several times in difficult situations, and it helped me. I cause it by quitting the world, then entering it and quitting it again as fast as I can. This action will regenerate the chunk you're currently in, and so it will erase the blocks you have placed, and will let you go out of the temple.

Hope it helps!