Yevamot, Chapter Twelve, Mishnah Five
This mishnah is concerned with an act of halitzah that was not done in the presence of three judges, as was required in mishnah one.
Note the structure of this chapter: the first mishnah dealt with judges and now the mishnah returns to this subject. As we shall see, the next mishnah stands independent of the rest of the chapter. That means that the mishnah was deliberately written in a chiastic structure (abba).
If she performed halitzah in the presence of two men or in the presence of three men and one of them was discovered to be a relative or in any other way unfit [to act as judge], her halitzah is invalid.
R. Shimon and R. Yohanan Ha-Sandelar declare it valid.
And it once happened that a man submitted to halitzah between himself and herself in a prison, and when the case came before R. Akiva he declared the halitzah valid.
According to the first opinion in the mishnah, without three valid judges, halitzah is invalid. Unfit refers to those unfit to testify as listed in Mishnah Sanhedrin 3:3-4. The list of which relatives are invalid to act as judges or witnesses is also found in the third chapter of Sanhedrin.
However, according to R. Shimon, R. Yohanan Ha-Sandelar (the sandal makerironic that a sandal maker is teaching laws of halitzah which uses a sandal), and their teacher, R. Akiva, the lack of three fit judges does not invalidate the halitzah.
According to the Talmud, this case mentioned in the mishnah, was brought before R. Akiva while he was imprisoned for breaking the Roman decree not to teach Torah.