The amount of foreknowledge about the box determines actions. Also the paranoia level of the dragon, and how many resources the dragon is willing to invest in it.

And, of course, the meanness level of the dragon.

I mean, the dragon could just fly it up a few hundred feet, and drop it onto a nice rocky outcropping to pop it open and see what's inside. Sure, that triggers the thing, but ... it really doesn't matter all that much to Mr. Dragon.

If he's willing to spend a little coin, he can do more.

Metal Melt (Spell Compendium page 140) will turn the box into a puddle around whatever it contains. 4th level spell scroll, which the dragon can use on a roll of 2 (caster level 7 on the scroll, vs. caster level 5 for the dragon by default). Dispel Magic can make the box nonmagical briefly if needed.

Animate Objects + Polymorph turns the box into a creature, and then turn it into a non-container... evicting anything inside (usually).

Disintegrate, obviously.

There's... really no shortage of methods.