Look at the LayerIds property of IdentifyParameters:
Optional. When layer Ids are specified, the server treats it as a boolean "AND" operator. For example, if the LayerOption Visible is specified and the LayerIds are set to [2,5], only layers with Ids 2 and 5, if visible, are identified.