If a mature woman prays next to a man without any partition, it will nullify the prayer of man if the Imam leading the congregation intended to lead women as well. If however, the Imam didn’t intend for women congregation, men’s prayer will be valid but woman’s prayer will be invalid.
When in such a situation, one can ensure the validity of prayer by doing one of the followings:
If he is praying behind the woman, then an arm-breadth wide plank should be erected in between or he is above the head of the woman. Failing to do any of these will nullify his prayers.
When praying fard salaah at home it is better to pray in congregation even if there are only women available.
The woman should stand behind the leading man even when there is a single woman praying along with him. This is different when two men are praying together as they stand side by side with the imam’s heels slightly ahead of his follower.
 Ahsan ul Fatawa vol 3, pg 365; Fatawa Mahmoodiyyah vol 16, pg 228