Drupal 7 Views: Display a Taxonomy term as its Term-ID number for a node
Here are few things you need.


In relationships, add Content: Taxonomy terms on node.
In Filter Criteria(I think this is the one you are missing), add Content: has taxonomy term and check the "is not empty(NOT NULL)".
In Fields: Add Taxonomy term: Term ID


PS: in step 2, you may pick other operator based on what you need.