Take the preposition into the relative clause.
A relative pronoun keeps the reference noun’s gender and number. A preceding preposition determines its case; the finite verb ends the clause.
Hinglish hintPreposition ko saath rakho: mit dem, für den. Gender noun se, case preposition se milega.
Find the reference
Der Kollege is masculine singular. We speak mit someone, so the relative pronoun must be dative.
Das ist der Kollege, mit dem ich arbeite.
Aha! See the common trap
Not thisDas ist der Kollege, mit den ich arbeite.
Try thisDas ist der Kollege, mit dem ich arbeite.
Mit always takes dative; masculine singular relative dative is dem.
More examples, less guessing
Das ist der Kollege, mit dem ich arbeite.That is the colleague I work with.
Der Freund, mit dem ich spreche, wohnt hier.Practice the highlighted construction in another context.
Die Stadt, in der ich wohne, ist groß.Practice the highlighted construction in another context.