Firstly, be honest about what the real problem is. There are lots of types of writers block. Is the problem that you cannot write at all, that you have lost faith in your writing or that you do not know what to write next? Think about which one is bothering you, and try the suggestions below.
You have lost faith in your work
Do you have a reliable person you can ask for feedback? It can be beneficial to have a reciprocal agreement with a number of people to give each other feedback. Send the piece to one of your contacts, explaining you need some feedback to start you writing again. The other person, if they are good at feedback, may be able to put their finger on the problem that has been niggling, or offer encouragement in the piece. This honest feedback can give you things to work on, which means you can begin again.
You have no idea what to write next in a piece
If you are writing a longer piece you may, for example, know the beginning and ending but not the middle. Try going on to a part you have more clearly in your mind first. This may set off ideas to fill in the blank. If the problem is that you have no idea what will happen beyond what you have written, try writing a letter in the style of the characters so you can more fully appreciate their reactions to what has happened so far. If you still find yourself unsure of where you are going, try writing something else and coming back to this piece when you have given it breathing space.
You have no ideas at all
If you have no ideas for starting places then try random research. Read through reference books, look at online encyclopedias or just flick through magazines. If you find a topic of interest then this can spark off ideas. You could try fan fiction, as it will have ready-made characters and environments. This will give you a starting point which may well become ideas for your own original characters.
You're just staring at the screen
It sounds like you need a break. Make sure you're not procrastinating; playing solitaire is not the same as being stuck! If you really cannot write anymore take some time out. You may well have worried yourself into a hole, so step away from the computer and read a book or watch some TV. If it is already late then have a good night's sleep. Start fresh in the morning and see if the situation improves.
You really mean to start writing, but...
We've all been there. You intend to get down to writing, but you have to check your email. And you have to have a good playlist to listen to while you type. And you can't write on an empty stomach. Cut through procrastination by setting yourself mini deadlines. You will, for example, write 500 words today, or finish the chapter by Wednesday. If that's still not enough motivation, make someone else check up on you. For example, arrange to send a chapter to a friend at the end of the week.
You have something you would rather work on
Does the piece you are working on have to be finished now? If not, put it aside to work on the more appealing piece. It may turn out to be a niggling plot bunny you just need to get out of your system, but it could become your bestseller.
If you do need to finish the first piece now, then use the other piece as a carrot. You can work on that when you've got this one out of the way. For the time being, avoid the other piece altogether as it is an unneeded distraction.
Someone has said something negative and you are depressed
It can be hard to take criticism. Listen to what the person said. Did they criticize your writing or the idea, for example. Maybe you think your plot is great, but another person may have seen it before. Or maybe the idea is good but your writing needs work. If you tend to be overly critical, you may have only heard the negative and not the positives. For example “it's great but there was a bit too much dialogue” is good criticism as you have something to work on. “I think it's rubbish” is useless criticism as it give you no focus. Avoid the person who gave you this feedback and seek a second opinion.
If, on the other hand, the person gave positives and negatives but you were very offended, you may be rather precious about your work. Put the piece aside and come back to it. When you have gained some distance you may see faults you had missed when you were writing it. Write something unrelated in between so you do not lose heart.