WARNING: This answer is applicable to Ubuntu version < 11.04, do not use it in a newer version as it will hard freeze your system
As per the other answers there is a package management app holding the lock.When unsure do not manually remove the lock, first run:
sudo fuser -cuk /var/lib/dpkg/lock; sudo rm -f /var/lib/dpkg/lock
This will kill any processes opening the file before removing it.