A trap is a form of underhanded attack intended to catch targets off-guard, granting the trapper the initiative and advantage over their opponent. Traps can also be security features designed to prevent entry into certain areas by making sure that trekking through them is a perilous affair.
Speaking of affairs, the beardiest of us have established that a woman is the perfect physical representation, the definition, of a trap. Not always deadly, but definitely the most effective, as there is no possible way of freeing yourself without internal or external damage.
In-game, traps can either be; devices designed to strike opponents unexpectedly like pitfalls and landmines, cunning tactics like ambushes and assassinations, or fighting moves like riposte or feinting. The main gist of traps, however, is that they must not be discovered before they are needed. Otherwise, most people can avoid traps and render them useless before they do their work. It may even work against the trapper and put themselves in a dangerous position instead.
In RPGs, a trap can either be a devilishly evil contraption that the GM placed into a campaign to trick the players or to somehow outsmart them (and hopefully kill them later) or a piss poor trick that a lobotomized retard could see right through.
A rather badass type of trap is a bear trap; either a pair of spring loaded mechanical jaws, or a trap that releases a hungry bear.
Traps are a staple in Dungeons & Dragons. They can take the form of anything from a spring loaded blade on a door, a pit full of spikes covered up by a net, an illusory wall or many others. It is generally used to screw with the players. The rogue in 3.5 and down is, pretty much, the only class that can deal with them, while in 4e anyone can effectively if they choose to work on that skill. The latest edition lets anyone with thieves' tools proficiency go to work on 'em, though rogues and bards both get specialized tricks to make them best at it.
Traps have become a widespread term used in places like /a/, /b/, /cm/, /d/, and /h/ to describe young crossdressing males and drag queens, and outwardly appear to be a cute girl. The term is also occasionally used as a term for transgender women and intersex people, though both generally find it deeply insulting, so don't use it around them unless you really want to be That Guy, or the person in question is ok with it or finds it endearing, like Bailey Jay. For people who don't want to use the term "trap", there is the alternative "tomgirl", a play on tomboy, but is just as derogatory, and has the infamy of being a term Chris-Chan uses.
The Japanese term for this is 男の娘 (otoko no ko), literally "daughter that is male" (Not "Daughter of Man," it's a common newbie mistake to think "no" always means "of"). This is a pun on 男の子, which is pronounced the same, but is just a catch-all term for "boy", literally meaning "child that is male".
Less common is the "reverse trap"; an extremely tomboyish girl whose generally small curves allows her to, intentionally or otherwise, pass herself off as a man.