Re: Target voltage detected Target Device ID (0x77a0000) is an Invalid Device ID.
PICkit3 has internal 4.7K pull-downs. Combined with your pull-ups, they create voltage divider. When the line is released by both PIC and PICkit3, the voltage is stuck in the middle. Therefore, don't expect reliable communications. If you have problems with your particular board, it's a good idea to remove the pull-ups.
When programming, PICkit3 sends lots of commands. It actively drives the PGD line all this time. Then it releases the PGD line (which goes to VDD/3 because of your pull-ups) and waits for the response from the PIC. The bit you're losing is the first to come out of the PIC (id is sent LSB first). It comes out as '0' instead of '1'. Could this be caused by the previous VDD/3 period? Unlikely, but given the "right" combination of voltage levels and sensitivity of receiving gates it certainly may happen.
Of course, there could be other reasons, such as bad contacts, bad soldering, or damaged chip. But it's a good idea to start troubleshooting from the obvious mishaps.