Each restraining order has its own terms as to how far away a defendant must stay from the complaintant. Typically it is 50 or 100 feet. If you become aware that your ex is within that protection zone, it is up to you to remove yourself from the location. However, if you were unaware that she was there, it is impossible to comply. You do not say if you were in fact arrested or not. If you were, you should hire the best criminal defense counsel that you can to represent you and defend your position on the matter. The consequence of violating a 209A order are criminal sanctions, which may include jail. If you wish to discuss this further you can contact my be telephone numbers provided on my website.
I would be happy to discuss this situation with you and what your options are. I recently won a jury trial on similar facts as yours. Give me a call if you are still seeking an attorney. Joseph Chancellor, (617) 725-2675