When we are presented with a new piece of music for the first time it can be difficult and frustrating. The best thing to do is to break the process down into two separate steps:

First, learn the notes.

This means learn where all the notes are in the song. Figure out where you will have to put your fingers ahead of time. Look over the whole piece to get a bird's eye view of the whole thing. If you are a beginner, don't expect to be able to play the whole thing all the way through immediately! Most important in this first step of the process is to figure out the mechanics. Don't worry about staying in time. Just figure out what physical motions your arms, hands and fingers will have to accomplish in order to play the song.

Second, practice the notes in time.

After you've figured out all the motions necessary, after you've "mapped out the piece", only then should you start to worry about playing the song in time. Only then should you worry about making all those notes and physical motions sound like music. Even then, start slowly. If necessary, play it much more slowly than the song is intended to be played. Only speed up once you've got the relative motions down properly. Repetition and patience are of utmost importance at this point.