More generally if M has dimension n, a codimension k foliation of M would be a pattern based on the model given in n-dimensional by equations xi = ci for i = n-k, n-k_1, ... , n. This is interesting in all cases with 0 < k < n. There is a close relation, assuming everything is smooth, with vector fields: given a vector field X on M that is never zero, its integral curves will give a codimension n-1 foliation.
This observation generalises to a theorem of Frobenius, saying that the necessary conditions, in terms of the Lie bracket, for local co-ordinates for a number of vector fields Xi to have solutions like the n-space model of the correct codimension, are also sufficient. One can also phrase this differently, as a question of reduction of the structure group of the tangent bundle from Gln to the subgroup H sending the subspace xi = 0 (i = 1 to n - k - 1) to itself. The conditions in the Frobenius theorem appear as integrability conditions; and the assertion is that if those are fulfilled the reduction can take place because local transition functions with the require block structure exist.
There is a global foliation theory, because topological constraints exist. For example in the surface case, an everywhere non-zero vector field can exist on an orientable compact surface for the torus. That's a consequence of the Hopf index theorem, which shows the Euler characteristic will have to be 0.