2,264. Permitted Forms of Yichud
Hilchos Issurei Biah 22:8
One woman may not seclude herself even with many men unless one of their wives is also present. Similarly, one man may not seclude himself even with many women. However, when there are many women and many men all together, we are not concerned with seclusion. If the men are outside and the women inside, or vice versa, and one woman or man went and joined the opposite sex, the prohibition against seclusion applies. Even a man whose occupation is with women may not seclude himself with them. Rather, he should occupy himself with them while attended to by his wife or find another profession.
Hilchos Issurei Biah 22:9
A man is permitted to seclude himself with two yevamos, two women married to the same man, a woman and her mother-in-law, a woman and her stepdaughter, a woman and her husband's daughter, or a woman and her mother-in-law’s daughter. Since these women are rivals, they won’t keep any inappropriate behavior a secret. It is similarly permitted to seclude oneself with a woman and a child who is old enough to understand what’s going on but who would not participate in any illicit activity. A woman wouldn’t behave inappropriately in front of a child who would reveal it.