Welcome to the forums, Robert!
Whew, you sure picked a doozy of a question for your first post!
I'm not sure what to tell you, other than to practice listening to the pitches of the singer's voice and then trying to pick out the notes on your keyboard.
That doesn't necessarily give you the "key," such as B minor, or E flat major, or something like that, but identifying the individual notes of the melody is the first step.
If you're trying to work out a piece by ear without having the sheet music, it's a good idea to have plenty of blank music staff paper to scribble on. It's actually pretty simple to make your own using a graphics program-- or for that matter, using a text editor (hint: use the underline character to make the lines with)-- and then print out as many sheets as you need. You should also be able to find some blank pages of sheet music online to print. Of course, there are music notation programs you can use, but it's usually quicker to draw the notes on paper by hand than to do it in a program-- although the program can be a way to make a nice-looking copy once you've worked it all out by hand.
I wouldn't worry about the durations of the notes at first; just focus on identifying which notes are being sung and put a dot on the appropriate line or space to indicate each note. Also, don't worry about identifying the octave at first, since it's more important to get the note.
If you practice playing a C major scale on your keyboard and trying to learn the pitches so you can get to where you can "hear" the notes in your head, then it will be easier to identify the sung notes by ear, because eventually you'll get familiar enough with each pitch to be able to say "That sounds like an F," or "I think that was a D," and so on; then you play that note on the keyboard to see if you were right, and adjust it as necessary. If you focus on learning the natural notes first, then you should be able to figure out the sharp or flat notes because they'll be in between two of the naturals.
Anyway, once you jot down the notes of the melody, including which ones are sharp or flat, you can look at which sharps and flats are being used to see if you can identify the key, since each key has a specific number of sharps or flats-- and they aren't just any sharps or flats; they follow a pattern. So determining the key is a matter of figuring out which notes of the melody, and how many notes of the scale which best fit the notes of the melody, are sharp or flat.
It can be a little more complex than that, because you might also need to consider whether some of the sharps or flats are merely "accidentals" rather than part of the scale, and you might also need to decide whether the piece is in a major scale or a minor scale. But that's the gist of it.
So to summarize, you first need to train your ear to identify which notes are being sung, then pay attention to which notes are sharp or flat, and try to identify the musical key from there.
There's a lot of music theory that can help, such as different types of chords and what the most commonly-used chord progressions are. But don't let that daunt you; just practice picking out the melody by ear, because that's the first and most important step.