there are hadiths:
https://sunnah.com/muslim:1341a : Ibn 'Abbas (Allah be pleased with them) reported: I heard Allah's Messenger (ﷺ) delivering a sermon and making this observation: "No person should be alone with a woman except when there is a Mahram with her, and the woman should not undertake journey except with a Mahram." ...
Uqba b. Amir reported Allah's Messenger (ﷺ) as saying: Beware of getting, into the houses and meeting women (in seclusion). ...
first hadith can be understood several ways:
being alone is categorised/sorted into degrees from most alone to least alone. like this: one woman, one woman with a (mahram) male child, two women (not relatives or very far relatives), two women who are relative to each other (i am not sure that this is less alones than just two women who are not relatives, but since relatives are going to have some connection during long time, they have more chance to act like a witness), two women who are relative to each other and to the potential visitor, three women, two women and a (man) mahram of one of her, two women and mahrams of each of them, etc. the most alone versions are disallowed to be with them until there is a adult mahram of every of them.
same or similar categorisation/sorting like in 1, but the most alone versions are disallowed to be with them until they are 2 or more adult women or 1 woman and 1 her mahram.
same sorting as in 1, but but the most alone versions are disallowed to be with them until they are 2 or more (adult) women close relatives to each other and to the visitor, or 1 woman and 1 her mahram.
and, other ways.
in https://islam.stackexchange.com/a/39171 III-AK-III says
Note also that there is a scholarly difference of opinions about:
- What constitutes not being alone: If there is a third person, man or woman, would that negate being alone in a religious interpretation of the word (of course, not the linguistic meaning of the word)?
interesting to know, which scholars or mazhabs are of more strict opinion, that adult (male) mahram is required for every women, and which are of less strict opinion like if they are relatives like cousins or daughters of cousins, with or without aunts (mothers or grandmothers of that women) etc of the potential visitor, it is allowed for him to visit even without a (male) mahram of them. and, which scholars allow visiting a big group, like 100 people, of adult women, (which are generally are not close relatives between themselves and to the potential visitor).