R/Bioconductor query for a gene?
Take a look at the biomaRt package. This package allows you to access some databases in R directly. Quote from the user's guide:


  The package enables retrieval of large amounts of data
  in a uniform way without the need to know the underlying database schemas
  or write complex SQL queries. Examples of BioMart databases are Ensembl,
  Uniprot  and  HapMap.   These  major  databases  give  biomaRt  users  direct
  access to a diverse set of data and enable a wide range of powerful online
  queries from R.


In the user's guide you will find anything you need, i.e. description and example tasks, for doing queries on HGNC symbols, GO terms, and more.