You can get the version number of _any_ installed package by passing pacman the `-Q` (query) flag.
pacman -Q $package
Pacman considers packages not in the sync database to be foreign: to print a list of all of these packages, you can pass the `-m` option to pacman:
pacman -Qm
From the `man pacman` page:
> -m, --foreign
> Restrict or filter output to packages that were not found in the sync database(s). Typically these are packages that were downloaded manually and installed with --upgrade.
As pacman knows nothing of the AUR (other than the fact that these packages, like any installed manually exist outside the repositories), you would need to use an AUR helper to retrieve the current version of a package in the AUR.
Cower is generally regarded as one of the better helpers (see the comparison table on the wiki page and **avoid** helpers that feature red fields):
cower -s $package