The usual way of deriving the equipartition theorem is through the manipulation of an ensemble average. Equilibrium ensemble probability densities in phase space depend on the canonical coordinates through the Hamiltonian. The kinetic part of the Hamiltonian of a system of $N$ particles in the 3D space has complete rotational symmetry, and therefore, at the level of probability density, it is impossible to have any unbalance between $x$, $y$ or $z$ directions of the velocity distribution.
Looking at the same thing in the language of time averages, the situation does not change. If time averages can be written as ensemble averages, the system must be ergodic, which means that no additional constant of motion exists, beyond energy. If the motion can be confined only along one coordinate direction, the system is not ergodic. That would be the case with the ideal gas. However, even if sometimes it is not explicitly stated, the application of statistical mechanics to the ideal gas implicitly assumes that some additional mechanism that ensures ergodicity is present, even though not appearing explicitly in the Hamiltonian (for example, one could imagine that a microscopic roughness of a thermalizing confining wall could be a sufficient source of chaotic motion to make the system ergodic).