It sounds like another case of lock actuator death that's afflicted some MY13 V40s - it's normally happened on the doors up to this point though. I think this may be the first case of it happening to one of the tailgate locks?
It seems Volvo were supplied with a dodgy batch of the electric lock actuator motors during the MY13 production run. Most of them seemed to find their way into rear door lock mechanisms, though there have been some cases of front doors being affected. They worked ok to start with, but for some reason would then stop activating leaving the doors permanently locked. Sometimes they could be temporarily unstuck by repeatedly locking and unlocking the doors, but eventually they would completely fail.
Volvo knew about this pretty quickly as some failed very early after the cars were built, but instead of initiating a recall (which they probably should have done as it's a safety-related issue) they waited for the actuators to fail and replaced them under warranty. Unfortunately this usually involved having to destroy the interior trim on the door to be able to unlock it to remove the failed actuator (the trims can't be removed properly without the door being open). As the cars have got older it seems that most of the ones that were going to fail had failed within the 3 year warranty, but there are obviously some outliers as there's at least one case on the forum where someone had a failed door actuator replaced free of charge after the warranty had expired.
Unfortunately I don't think here is any other way to open the tailgate if the lock actuator has failed except removing the tailgate trim from inside the car and releasing the lock manually. This would probably destroy the tailgate trim (as is the case with the doors it's designed to be removed with the tailgate open)) so you are probably best going to a dealer to get them to sort it out. Before they do any work I would ask them to confirm that the lock actuator and any parts damaged getting to it would be covered outside warranty as otherwise you may be looking at a hefty bill.