get all levels parents from id term

You can get all of the parents of an object via get_ancestors

$term_id = 42;
$your_taxonomy = 'sometax';
$parents = get_ancestors( $term_id, $your_taxonomy );