Relative clauses with a preposition
When the verb or the place needs a preposition, the preposition comes before the relative pronoun and sets its case, while the noun still sets its gender and number.
In the Dativ the relative pronouns are dem, der, dem and, in the plural, denen. They look like the definite article, except denen. A verb with the Dativ, such as helfen, takes these forms without a preposition: die Leute, denen ich helfe.
With a preposition, the preposition comes first, then the pronoun. The preposition sets the case: mit and bei take the Dativ, so die Kollegin, mit der ich arbeite. in takes the Akkusativ for a direction and the Dativ for a place: die Kita, in die Beatriz geht; die Kita, in der Beatriz spielt.
The gender and number still come from the noun: das Zimmer, in dem Beatriz schläft; die Großeltern, bei denen die Kinder sind. For a place you can also use wo: die Stadt, wo ich wohne.