A two-dimensional lifeform was a lifeform that was known to exist in a single plane only. As such, they had length and width, but no height. These lifeforms could exist in space and generally stayed within the same plane as others.
In 2367, the USS Enterprise-D encountered a group of two-dimensional lifeforms. They made their home in a cosmic string, which had a gravitational attraction like black holes or homing beacons for two-dimensional beings. Because they only existed in a single plane, starship sensors had difficulty detecting their existence, even through the use of Bayesian functions. In that instance, Data ultimately detected their presence by using two probes to scan the space around the ship. They affected the space around them through polarizing an emanating graviton field. Catching the ship in its wake, the Enterprise was carried to the cosmic string until it reflected the appearance of the string, disrupting the beings' motion long enough for them to escape. (TNG: "The Loss")