How do I use "DOES NOT CONTAIN" with \Drupal\Core\Entity\Query\QueryInterface? I have a node with a list field of text values. I want to write a query that gets all nodes that don't have one of the selected values.

How do I write this query?

$query-&gt;condition('field_states_excluded', $state, 'DOES NOT CONTAIN');
You can make use of NOT REGEXP if we assume that $state is an array of multiple states.  

I will explain with example:
for example if want to get all nodes with the field title DOES NOT  CONTAIN page, hello, and test.

Sql statement should be something like:  

SELECT * FROM `node_field_data` WHERE `type` = 'page' AND `title`  NOT REGEXP '^.*page.*$|^.*hello.*$|^.*test.*$';


Drupal Code:

  $excluded_strings = array('page', 'hello', 'test');
  //- Add regex prefix and suffix
  $excluded_strings_with_regex = array_map(function ($val) {
    return '^.*' . $val . '.*$';
  }, $excluded_strings);
  //- Join array elements with a string | glue 
  //- result $regex_p_string = "^.*page.*$|^.*hello.*$|^.*test.*$"
  $regex_p_string = implode("|", $excluded_strings_with_regex);
  //-Build Query
  $query = \Drupal::entityQuery('node');
  $query-&gt;condition('status', 1);
  $query-&gt;condition('type', 'page');
  //- Add regex Condition.
  $query-&gt;condition('title', $regex_p_string, 'NOT REGEXP');
  $nids = $query-&gt;execute();