فَإِنْ قَامَتِ امْرَأَةٌ إِلَى جَنْبِ رَجُلٍ، وَهُمَا مُشْتَرِكَانِ فِي صَلَاةٍ وَاحِدَةٍ: فَسَدَتْ صَلَاتُهُ.
Meaning: If a woman stands alongside a man while both share one prayer, his prayer becomes invalid.
This is the classical Hanafi rule of adjacent alignment. The clause “participating in one prayer” is essential; merely praying in the same building or separate rows is not enough to trigger this particular rule.