Negate a block visibility condition
There are visibility settings where, we can select which pages the block can be visible.
The same form has an underlying functionality to hide the block for the selected list or URLs.
Unfortunately, the same is not the case of Roles.
You can select which roles you want to display the block, but, you cannot select which Roles you want to hide the block.
Following code adds a Negate condition to Roles Visibility:
/* Negate the condition to decide visibility of which user roles to show/hide. */
function YOUR_MODULE_form_block_form_alter(&amp;$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
    $form['visibility']['user_role']['negate'] = [
        '#type' =&gt; 'radios',
        '#title' =&gt; '',
        '#default_value' =&gt; 0,
        '#options' =&gt; [
            t('Show for selected Roles'),
            t('Hide for selected Roles'),
        ],
    ];
}

This adds two radio buttons under the form: Roles.
Following is the screen shot for the same:

Reference: