Let
$$\vec{f}(x_1,x_2) = g_1(x_1,x_2) \hat{i} + g_2(x_1,x_2) \hat{j} + g_3(x_1,x_2) \hat{k}$$
then using the definition of divergence we get,
$$\mathrm{div} f = \sum_{i = 1}^{2} \frac{\partial{g_i}}{\partial x_i}$$
what happens to $ \frac{\partial g_3}{\partial x_{what}}$, since I don't have third co-ord to take derivative with?
How is divergence defined for such cases if at all?