(covers information from several alternate timelines)
A trap was a physical device or a tactic used to catch someone or something.
In 2263 of the alternate reality, the alien scavenger Jaylah had set up traps around the crashed USS Franklin, including a smoke cloud that would harden and created an impenetrable wall which could only be broken by a charge from her staff weapon. After landing on the planet, Captain James T. Kirk and Ensign Pavel Chekov were caught in this trap before Jaylah released them. During the attack on Krall's base, Jaylah equipped a PX70 motorcycle with this particular trap as well as her holographic technology for Kirk to use as a distraction. When the final group of Enterprise crewmembers were surrounded by Swarm drones firing on all sides, Kirk deployed the trap from the exhaust pipe of the motorcycle, shielding the crew long enough for them to be beamed to the Franklin. (Star Trek Beyond)
In 2366, when a science project of Wesley Crusher's went wrong and some nanites escaped his laboratory, he put small traps all over the ship, including Ten Forward, in order to catch the tiny nanites. He was successful and caught at least one nanite. (TNG: "Evolution")
In 2375, the Hazari apparently did not cover all possible flight paths the USS Voyager could take, but Captain Janeway was convinced those open routes were in fact traps. Later on, Kurros suspected Janeway had set up a trap when the Hazari were attacking the Voyager. (VOY: "Think Tank")