Updated:

1. Remove water around you

/fill ~-15 ~-10 ~-15 ~15 ~ ~15 minecraft:air replace minecraft:water

Only the block named after replace changes, so terrain and builds stay.

2. Remove lava

/fill ~-15 ~-10 ~-15 ~15 ~5 ~15 minecraft:air replace minecraft:lava

Swap minecraft:air for minecraft:stone to fill it in instead.

3. Clear kelp and seagrass

/fill ~-15 ~-10 ~-15 ~15 ~ ~15 minecraft:air replace minecraft:seagrass
/fill ~-15 ~-10 ~-15 ~15 ~ ~15 minecraft:air replace minecraft:tall_seagrass
/fill ~-15 ~-10 ~-15 ~15 ~ ~15 minecraft:air replace minecraft:kelp
/fill ~-15 ~-10 ~-15 ~15 ~ ~15 minecraft:air replace minecraft:kelp_plant

These plants hold water inside them, so water seems to remain until they are gone.

4. Block limit

Fill changes up to 32768 blocks at once. The area above is 10571 blocks; split bigger oceans into parts. On Java, raise the limit with max_block_modifications (commandModificationBlockLimit on 1.20.3 to 1.21.10). See the fill command.

5. Drain water as you walk

execute at @a[tag=drain] run fill ~-3 ~-3 ~-3 ~3 ~3 ~3 minecraft:air replace minecraft:water

In an always-active repeating command block, this keeps a 7x7x7 space dry around every player tagged drain. Great for ocean monuments and underwater builds. Start with /tag @s add drain and stop with /tag @s remove drain.

6. Make a dry glass tunnel

/fill ~-2 ~-1 ~ ~2 ~3 ~20 minecraft:glass replace minecraft:water
/fill ~-1 ~ ~ ~1 ~2 ~20 minecraft:air

The first line turns the water around the tunnel into glass and the second hollows it out. You get a 21-block tunnel heading south (positive Z) with a view of the sea. Swap the X and Z numbers to change direction.

Troubleshooting

Check your command

The Command Error Doctor checks common syntax mistakes in your browser.