Get posts of an specific term of a custom taxonomy

You need to use the methods of your query instance, rather than the global functions (which are merely wrappers for the global $wp_query):

if ( $query->have_posts() ) {

    $term = $query->queried_object;

    while ( $query->have_posts() ) : $query->the_post();
        //Output my posts
        the_title();
        the_content();
    endwhile;
}