You have found the correct vocabulary, but your grammar is a little bit off.
The preposition which initiates the relative clause is the preposition demanded by the verb of the relative clause. In your case: The relative clause has the verb
über etwas sprechen, so the preposition initiating the relative clause should be
Wir sollten achten, über was der Lehrer spricht.
Now you may see, that the preposition of the verb in the main clause is missing. In your case:
auf etwas achten is missing the
auf. As the relative clause is relative to something and this something needs to be a substantive group, you need a substantive group in the main clause, that embodies both your preposition
aufand can be referenced by the relative clause. This is done by the ü pronomial adverb
Wir sollten darauf achten, über was der Lehrer spricht.
Beware, that there is also the verb
etwas achten in German, which means
to honour sth. instead of
to pay attention to sth.. Consequently, also the first sentence I wrote is grammatically correct and senseful, but it means something different.