A pin joint will maintain constant distance between two bodies. I'd suggest adding one between the centers of each body unless you want B to move up and down as A rotates.
However, this will not guarantee that B will always be below A. For instance, if the forces and velocities of each body do not match then it is likely that they will move out of alignment (although the pin joint will keep their distance constant). I can't think of any combination of existing constraints that is capable of keeping B directly below A. The simplest option would be to make bodies A and B into shapes 1 and 2 of body A (no constraints required since shapes never move relative to their body) and give that body an infinite moment of inertia to prevent torque from rotating it. If it's necessary to keep them as separate bodies then I think you may need to write your own constraint solver (see cpPinJoint.c for an example).