Wa `alaykum as-Salamu wa Rahmatullahi wa Barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
Dear brother, thank you very much for your question and for your sincere interest to be a good practicing Muslim.
It is known that keeping a dog for no valid reason is not acceptable in the Shari`ah. However, if one is forced to live in a place where a dog resides, he has to keep himself away from its salvia so that he may not get impure (najis).
In his response to your question, Dr. Wael Shihab, PhD in Islamic Studies from Al-Azhar University, and currently the Imam of the Downtown Toronto Masjid in Canada, stated,
A Muslim is not allowed to keep a dog except for an acceptable reason such as guarding. However, he has to take every precaution not to have contact with its saliva, and also arrange for a separate living space.
If you live in a place where a dog is kept for no valid reason and it is beyond your control to correct the situation, then you are blameless. However, you have to keep your room, food, clothes, etc., away from the dog’s direct contact.
May Allah accept your and our good deeds!
Allah Almighty knows best.