Different strokes for different folks. What holds true for one style may not necessarily be the same for another. For this discussion, I'll limit my contribution to the Japanese and Okinawan styles.
In general, all black belts hold a dan ranking. Holding a dan ranking, though, does not necessarily imply any particular level of mastery, only that the rank holder has attained a sufficient mastery of the basic fundamentals, and is capable of learning the more advanced techniques.
There are instructor ranks of all sorts. In general, a full fledged sensei, loosely translated to "one who has gone before," usually holds a 3rd dan ranking, or higher. Just because one has a 3rd dan ranking, though, does not automatically make him a sensei.
There can be instructor ranks below sensei. Sometimes such lower ranked (usually 1st or 2nd dan) instructors are sometimes called ko-sensei, or sempai, depending on the style. Even if one has a ko-sensei title, it's not unsual to call him just plain ol' "sensei" at times, or if a more senior instructor is addressing him, he may be called "ko-sensei."
There can be instructor ranks above sensei as well. The most common is known as "shihan," which is translated as "teacher of teachers." Where does that sensei to shihan rank border lie? That's not easy to answer, since some styles might make several eligible to become a shihan at 5th dan, while others might only give that title to the top person in the style.
Thus, very loosely speaking, the pecking order, from low to high would be:
Sempai / Ko-sensei
Sensei
Shihan
Remember, some styles might not even bother with a Sempai / Ko-sensei classification, and that there are certainly 1st dan sensei around. This does not imply anything at all, regarding the instructor's skill.
There are other honorary titles used for the more advanced sensei / shihan of a style. These are loosely classified as follows (please note, my definitions need not be the same as anyone else's), assuming that judan is the top rank:
Tachi: For instructors who are considered mid-level within a style. Usually 3rd or 4th dan.
Renshi: An more highly advanced instructor. Usually a 5th or 6th dan, and has demonstrated leadership and achievement within the style.
Kyoshi: A master instructor. Usually 7th or 8th dan, and has gone above and beyond what he already has done as a Renshi.
Hanshi: Professor equivalent. Usually a 9th or 10th dan. Some styles will only have one Hanshi within their system, others may have more.
It's also noted that some styles go from Renshi to Hanshi, skipping the Kyoshi level, and that other styles might have different rank requirements for the titles. For example, in certain Jiu-Jitsu styles, there are 4th dan Renshi, and 8th dan Hanshi. It's all simply a matter of the style's system.