actually the guard knew that Ivy is a girl but keeping it quiet since they realize that shes pretend to be a boy while traveling and they also realize Ivy want to keep it that way. The captain and vice captain had told the guards about Ivy so that they could at least help her with what they can do for her.