In the theory of perfect competition, there will in general be no x-inefficiency because if any firm is less efficient than the others it will not make sufficient profits to stay in business in the long term. However, with other market forms such as monopoly it may be possible for x-inefficiency to persist, because the lack of competition makes it possible to use inefficient production techniques and still stay in business. In addition to monopoly, sociologists have identified a number of ways in which markets may be organizationally embedded, and thus may depart in behavior from economic theory.
X-inefficiency is not the only type of inefficiency in economics. X-inefficiency only looks at the outputs that are produced with given inputs. It doesn't take account of whether the inputs are the best ones to be using, or whether the outputs are the best ones to be producing, which is referred to as allocative efficiency. For example, a firm that employs brain surgeons to dig ditches might still be x-efficient, even though reallocating the brain surgeons to curing the sick would be more efficient for society overall.