The warden does not despawn (dig into the ground) while it is floating in lava.
I encountered a non-despawning Warden in survival mode first, and checked what was going on by going into spectator mode. The warden had been summoned into a small cave with a pool of lava.
I confirmed this in creative mode by summoning a warden with some sculk sensors and a shrieker set to can_summon using a debug stick, then replaced the blocks it was standing on with lava (1 block deep). The Warden does not despawn in lava.
Tested with spawn egg as well, the Warden on solid ground walks around and eventually despawns, while the one in lava does not.
EDIT: further testing shows the warden does pathfind out of the lava to wander, or attack an entity it sniffs or is it enraged at. However, if it can't get out of the lava (blocks in the way), it does not dig into the ground, nor does it use its rage animation or attack. It despawns normally if the player moves 128 blocks away.
EDIT2: more testing. It seems the Warden sometimes does not attack or pathfind out of the lava or even attack players within range, even if obstacles are removed. I tested caging it so it couldn't escape the lava pool, then attacked it with a snowball and summoned a snow golem to attack it. It did not move or use its ranged attack even after I removed the blocks preventing it from stepping out of the lava pool, nor did it attack me when I got up close. It seems like its AI gets confused if it is stuck in lava and cannot reach an entity attacking it. I cannot seem to reproduce this with any consistency, but it does happen sometimes.
EDIT3: Ok now I'M confused. I just watched the Warden despawn without its digging animation (and I was well inside 128 block range). This happened several times both with the Warden stuck in lava, and the one on solid ground, but again I cannot consistently reproduce it.
EDIT4: Ok it's just the normal random despawning that happen to all mobs outside 32 blocks range. It seems strange that the Warden is subject to this, considering it has its own despawning behaviour.