A CR 9 critter is a potential TPK for a 5th-level party; they should attempt to flee or bypass it. If they are forced to fight this pudding to the death, using only the standard abilities of 5th-level PCs, they have only the slimmest chance of survival.
My suggestion is to make the encounter into a puzzle rather than a combat. Give them clues right at the outset that they can't affect the monster, and give them a small head start running away. Then it turns into a game of hide-and-seek, as it hunts them through the dungeon while they search for a way to kill it.
ConcreteBuddha's suggestion of nonmagical acid is a good one, as long as there's some in-game reason for large quantities of acid to be lying around. This sounds like a job for the old rickety-catwalk-above-an-open-vat-of-toxic-waste convention. Dropping it into a fresh lava flow would also work; resistance 20 doesn't help much when it's taking 20d6 damage per round.
Or, you could contrive to let the PCs find a few Arrows of Ooze Slaying. With the pudding's abysmal AC, an archer is unlikely to miss; the monster will need to roll a 13+ on a Fort save or be destroyed.
I was going to suggest a scroll of Flesh to Stone, but it turns out to be very inefficient. Considering the activation check (for a 5th-level reader), the SR roll, and the pudding's save, it'd only have an 18% chance of working.