STM32F0 Disco on-board "Cannot connect to target"
I also had (and still have) this problem (with an ST-Link V2 and STM32F103C8T6 development boards). Although I do not know a real solution, what helps with me is:


Removing the ST Link from the USB port and reinsert it
As above, but moving it to another USB port
Removing the USB power from the development board
As above, but moving it to another USB port
If the above steps do not help, start up the STM-32 Link Utility, perform a firmware update (in the ST-Link menu)