You can convert between 3D and 2D coordinates in a variety of ways, some of which have more meaning than others. For example you could just drop the Z coordinate, yielding an (x,y) pair, but that probably doesn't do what you want semantically.
But you're specifically asking how to convert between model, world or view space 3D and screen space 2D as used by your graphics API, it sounds like. This primarily involves application of the appropriate transformation matrix, as well as performing the perspective division by W and any viewport transformations that may be warranted. gluProject does exactly this operation, all you have to do is provide it with input coordinates and matrices.
gluProject assumes the input coordinates
objZ to be in model space, but they can be anywhere as long as the matrices you provide it via the
proj parameters have associated meaningful values. The format of the
proj matrices is an array of 16 floating point values, the same kind of data you'd get from
glGetFloatv and such. The
view parameter is an array of 4 integers representing the position and size of your viewport (from
glGetIntegerv for example).
To perform the operation in reverse, you can use gluUnproject. Note that since you'll have a 2D coordinate you'll have manually specify an arbitrary depth value. The 3D → 2D conversion perforce loses data, so you must invent new data when going in the other direction.