You may not have a choice. If I were A and you were to tell me you had an offer from another school, I would immediately ask the name of the school B.
Your refusing to tell me B's name may raise some red flags for me (indicating a level of shiftiness about your candidacy that I may not have been aware of). I cannot think of a good reason why you wouldn't tell me -- other than B is so far below my institution's rank that it'd be laughable (aka, A=MIT and B=Poconos Community College).
However, if B=CalTech and A=MIT, then I would very much make sure that we were processing your application with all due haste.
With the new details that A=preferred for personal reasons but B=higher ranked, then certainly you can tell A that you have an offer from B. It would likely lead to increased interest in your candidacy if A is at least somewhere the same ballpark as B.
That is, if A were Poconos Comm College and B were CalTech, then A may feel that there is no possibility of getting you and drop you even before an offer for being overqualified. You need to emphasize why you are so interested in A.
Note that lying is a bad idea. If we phoned our colleague at CalTech and they had no idea who you were, you'd be immediately dropped.