Drupal - How do I get the taxonomy term ID from its name?

taxonomy_get_term_by_name() will do the trick:

$terms = taxonomy_get_term_by_name($row->field_term_name);
if (!empty($terms)) {
  $first_term = array_shift($terms);
  print $first_term->tid;
}

It's taxonomy_get_term_by_name() which you use as in the following code.

$term_array = taxonomy_get_term_by_name('Foo');
$term = reset($term_array); # get the first element of the array which is our term object
print $term->name;