The easiest way to do this is asking harmless questions ("How are you doing?","How was the weekend?") in a situation where you and him/her are undisturbed, but signaling with calm voice, body language, intent hearing with long deliberate pauses and maintaining eye contact that you are actually listening. You are indicating that this is not chit-chat, but signalling subconsciously that you feel that something is off and that you actually care. It is good if you know addresses of crisis centers beforehand.
People will immediately recognize what you are doing without any words which could be criticized as prying.
If he/she is having currently a bad situation which they think they are able to handle, they will act likely a little abashed ("Uh, he recognized that I am in a bad mood") and giving positive, reassuring responses or, if it is not serious and like to vent off steam, they will tell the story ("Ah, it's all right. But there is this carpenter..."). It is not 100% safe, it is still possible that someone is having trouble and faking to be ok, but you cannot do anything about it.
If, on the other hand, there really is a problem, they will grow very quiet and will have trouble to maintain eye contact. Don't say anything, retain distance and respect their boundaries (do not search for eye contact if not initiated), let them choose how to continue, even if nothing happens for minutes. Even if they break up the talk, they will now know that you
It is also possible that they will hastily stop the talk or act angry out of proportion (because they have not accepted themselves that they need help because their self-image does not allow to be "weak"). Do not feel intimidated or embarassed, you simply cannot do anything about it.
Depression is very insidious because the most natural reaction, withdrawing, is the worst reaction becauses it starts a vicious cycle. Suicide is one of the topmost killers in the world and almost always people will give out warning signals before something happens. Simply listening can save lives.