How to output hierarchical taxonomy path, with only the deepest term assigned?

Use get_the_terms to fetch the post’s term, then use get_ancestors to get an array of that term’s parent IDs.

$tax = 'category';
$terms = get_the_terms( get_the_ID(), $tax );
if( $terms && ! is_wp_error( $terms ) ){
    // check for and output any ancestors
    $ancestors = array_reverse(get_ancestors( $terms[0]->term_id, $tax ));
    if( $ancestors ){
        foreach( $ancestors as $ancestor ){
            $parent = get_term( $ancestor, $tax );
            if( $parent && ! is_wp_error( $parent ) ){
                echo $parent->name;
                echo get_term_link( $parent );
            }
        }
    }
    // output directly assigned term
    echo $terms[0]->name;
    echo get_term_link( $terms[0] );
}