The separability approximation in nonhomogeneous gases