I have two vectors in 3D Cartesian coordinate space such that each vector is described by components .
I would like to find the angle between these two vectors in the xy coordinate plane, ie. viewed from an observer located on the z axis.
Can I simply set the z component of each vector to zero and calculate the angle between them using the definition of the dot product? If not, what do I do to project the 3D vectors onto the 2D xy plane?
To project $3$D vectors onto $2$D $xy$-plane (also known described by the hyperplane $z=0$), simply set the third coordinate to zero.
Hence the two process that you described are the same.
To show that it is valid to set the third coordinate to zero, we are minimizing $$(\hat{x} - x)^2 + (\hat{y} - y)^2 +(0-z)^2$$
where the variables are $\hat{x}$ and $\hat{y}$. The minimal value is attained at $(x,y,0)$.