Include only one category but Exclude if is in a category from loop

You would use multiple arrays in the tax_query and make sure you use the AND relation so it combines them, like so:

$q->set( 'tax_query', array(
        'relation' => 'AND',
        array(

            'taxonomy' =>  'product_cat'

            'field' => 'slug',

            'terms' => 'CAT A',

            'operator' => 'IN'

        ),
        array(

            'taxonomy' =>  'product_cat'

            'field' => 'slug',

            'terms' => 'CAT B',

            'operator' => 'NOT IN'

        )
    ));