An undocumented woman was detained by two agents as she exited a courtroom after asking for a protective order. Federal officials have said they took her into custody outside the courthouse.