Generally speaking, as an adventure designer you can put whatever traps and defences you like in the place the heroes are supposed to infiltrate. In fact, the more the better. You can cover all the possibilities you can think of - there's no need to leave any sort of vulnerability. Because the PCs will inevitably come up with some wacky plan that avoids all of the pre-planned countermeasures.
The problem only arises if you don't put enough countermeasures into the adventure design. Because if you have just one single, lone, solitary trap, on the expectation that the heroes will easily avoid it by any of a number of obvious ploys - then you can absolutely guarantee that they'll blunder straight into it.
Except when it works the exact opposite way.
Transcript
Luke: So Han and I are going to be killed?
Chewbacca: There are fates worse than death.
Jabba: Ho ho ho ho!
C-3PO: And the rest of us enslaved forever.
Rogua: On yer bike! Oink!
Salacious Crumb: Ho ho ho ho!
Salacious Crumb: Oink!
Luke: This is one tough adventure.
Leia: Have we screwed up or have you ramped up the challenge level?
GM: Let me put it this way. I designed Jabba's palace with typical defences and countermeasures for a minor boss.
GM: If I hadn't given the guards shock-proof suits, Jabba immunity to Force Suggestion, and put an alarm system on Han's defroster, the whole encounter would have been a walk-over.
GM: I was sure you'd get around them the same way Luke got around the laser-proof Rancor.
Luke: Laser-proof?
R2-D2: Besides, it's not over yet.
GM: And at the end I added a bog-standard pit trap, in the throne room, no less, because what the hell, there's always a pit trap... and you fell straight into the damn thing!
GM: Thank goodness I didn't put a rake on the floor.