Error with PHP 8

You are using a global variable called $post in your code, but this variable is not defined.

To fix this issue, you can try defining the $post variable at the top of your script:

 <?php
    global $post;
    
    if (get_the_terms($post->ID, 'ausstattung')) {
      $taxonomy_ar = get_the_terms($post->ID, 'ausstattung');
    echo "";
      $output="<ul>";
      foreach ($taxonomy_ar as $taxonomy_term) {
        $output .= '<li>'. $taxonomy_term->name .'</li>';
      }
      $output .= '</ul>';
    
      echo $output;
    }
    ?>