Guess it will help to be a bit more specific on chests (Barrels/Crates/Whatever, depends on the dungeon):
There are 3 types: Physical, Magical and Cursed. They can be trapped or locked or both. Or neither, but that's pretty rare. You can smash them with a weapon but that will set off the trap and destroy whatevers inside.
Physical can only be disarmed/unlocked by Rogues and Bards, although bards not as well since they have lower skill caps. If they sense traps and get "You are certain this is not trapped", it is a physical chest and may still be locked, so they can try to unlock it. If they get message saying they can't tell, it is most likely magical or physical. If it tells them it is trapped, they can attempt to disarm it. Have remove curse and cure poison/disease spells loaded :)
If its magical, you need an Int caster (Wiz, Ench, Magician). Wizards are "better" than the other 2 (Like rogues vs. bards for physical). If an int cast tries to cast the detect trap on a physical or cursed chest, you'll get a red "This spell only works on magical items" type message (Like trying to cast ward undead on a non-undead). If it's trapped, you need to cast remove trap. The detection spell requires a reagent bought from the Magus NPC at the wayfarer camps. Once the trap is removed, try and open it, if it's locked cast the open lock spell. You cannot cast remove trap until you successfully cast detect trap, so don't think you can get away with just casting remove trap right away. I tried that already :)
Ditto all that for cursed: Clerics, Shaman & Druids. Clerics are the "best". Necromancers get both the cursed and magical spell versions that shm/dru and mag/ench get.
When buying them: MAKE SURE YOU ARE GETTING THE RIGHT VERSION. In the Adventure merchant window, check the box that says "Show only items I can use" so you don't buy the wrong class version of the spells. Good idea for any class really, would suck to buy an item/aug/spell you can't use, all the stuff is no drop (Although augs can be refunded)
There are three levels of the spells as well. Lesser, regular and greater. Honestly it's better to just save up for the greater versions of all three spells, the lesser and regular versions will stop working on higher level chests.