Primer: Imagine, a girl is talking to Tom. You want to know who she is and ask a friend whether he knows her. You could say:
A girl is talking to Tom. Do you know the girl?
That sounds rather complicated, doesn’t it? It would be easier with a relative clause: you put both pieces of information into one sentence. Start with the most important thing – you want to know who the girl is.
Do you know the girl …
As your friend cannot know which girl you are talking about, you need to put in the additional information – the girl is talking to Tom. Use „the girl“ only in the first part of the sentence, in the second part replace it with the relative pronoun (for people, use the relative pronoun „who“). So the final sentence is:
Do you know the girl who is talking to Tom?