For the volume case, the integrand is constant (implicitly 1), so integrating with respect to one variable (like z) simply multiplies the area of the base by the height, reducing it to a double integral. For the mass problem with variable density ρ(x,y,z)=xyz, the density changes with z, so the integration must be performed over all three dimensions to accumulate the varying mass contributions.
Conditions: The goal is volume rather than mass with variable density.; The integrand over the volume is constant for the volume case.; The density varies with position for the mass case.