From refseq ids to Go term Ids
So, I've looked a bit into this and the way you want to do your analysis won't work as you planned it. The main reason for this is that the GO database does not contain any virus species (as fas as I could see). The existence of the species you want to analyse in the database is important, because you need to have a background or reference gene set in order to perform enrichment analysis. Even if you're just interested in the IDs and want to perform the analysis by yourself, this means that you're unlikely to find anything for your genes/proteins in the GO databases.

Your best alternative is to use other annotation databases and either rely on their annotation or map their annotation to GO term ids (here is a list of all databases that allow this).  

Your best bet for this is probably the UniProt database, since that should have entries for most of your proteins (though not all will have annotated GO terms). UniProt also offers an ID mapping tool that should be able to convert your RefSeq IDs to uniprot IDs, and also comes with an API for python. Do note that some of your IDs (the YP_ ones) are provisional RefSeq entries and the webpage tool only finds them in the 'UniParc' database (not UniProt KB).

Once you have the the UniProt IDs you should be able to map the available GO terms from there (see the last entries of the first link above).