Praise be to Allah.If the condition of those with whom you live is as you mentioned, appealing for help from other than Allah, such as appealing for help from the dead and the non-living or the trees or stones or planets and the like, then they are committing the greatest shirk which causes expulsion from the community and faith of Islam. It is not allowed to ally with them just as it is not permissible to ally with non-believers. Praying behind them is not valid. It is not allowed to mix socially with them nor to reside amongst them except for the one who calls them to the truth with knowledge, and sees hope that they will accept and that their religious condition will become correct due to his efforts. Otherwise, it becomes obligatory for him to abandon them and to join a different community in which he can work with on establishing the fundamentals of Islam and its branches and reviving the example of the Prophet (peace be upon him). If he is not able to find the proper community, he should seclude himself from all communities, even if he experiences harshness, as has been related by Huthaifa (may Allah be pleased with him), who said:
“The people used to ask the Messenger of Allah (peace be upon him) about goodness. And I used to ask him about evil from fear of falling in it. So I said, O Messenger of Allah, we used to be in ignorance and evil but Allah gave us this goodness, so is there evil after this goodness? He said: “Yes”. So I said is their goodness after this evil? He said “Yes and it has some darkness” I said what is its darkness? He said: “A people following an example other than my example and calling to a guidance other than my guidance; you would agree with some of what they do and disagree with some.” So, I said is there any evil after that goodness? He said: “Yes, callers on the doors of Jahanam (the Hellfire); whoever answers their call to it are thrown in it.” So, I said: O Messenger of Allah describe them to us. He said: “They are from amongst us and they speak with our tongues” I said: O Messenger of Allah, what do you command me to do if this happens in my time. He said: “Adhere to the community of Muslims and their leader.” So, I said: What if there weren’t a community of Muslims nor a leader? He said: “Then seclude yourself from all the communities, even if you were to bite on the root of a tree until death”
Mutafaqun alayh (lit. agreed upon, i.e. narrated by both Muslim and Bukhari). Blessings of Allah be upon our Prophet Mohammed, his family and companions.