Hasan al-Basri (may Allah have mercy on him) said: If a man has two wives, forbids one from going out, and the other goes out, and he mistakenly thinks it is the forbidden wife and says: "Did you go out? Then you are divorced," then the divorce will apply to the one he intended.
Hadith Referenceسنن سعید بن منصور / كتاب الطلاق / 2353
Hadith Takhrij«أخرجه سعيد بن منصور فى «سننه» ترقيم الدرالسلفية برقم:، 1176، وعبد الرزاق فى «مصنفه» برقم: 11303، وابن أبى شيبة فى «مصنفه» برقم: 18351»