I’ve read that if you’re salah is not accepted nothing else you do get accepted. For instance, if you build a mosque but your salah is not accepted then your good deed building the mosque is also not accepted. So what I’m wondering is, how do we know our salah is accepted? Is not focusing during prayer something that leads to the prayer not being accepted?

That is for someone who does not pray. If someone prayed and they are having trouble concentrating, their prayer is still accepted.