WordPress REST get all items without a taxonomy assigned

I was able to solve the problem by adding a custom route. Although i had to do the same process in php by first querying all available terms of the type and then exclude them from the query.

$available_terms = array_map( function ( $term ) {
            return $term->term_id;
          }, get_terms( 'lagerboxen_kategorie' ) );

return get_posts( [
            'post_type' => 'lagerboxen',
            'tax_query' => [
              'relation' => 'AND',
              [
                'taxonomy' => 'lagerboxen_kategorie',
                'field'    => 'term_id',
                'terms'    => $available_terms,
                'operator' => 'NOT IN'
              ]
            ]
          ] );

Of course it is still interesting if there is a better way 🙂