(She joined our firm ten years ago.) She had worked for the previous
five years with an advertising company. vs. She had been working for
the previous five years with an advertising company.
This is one of those situations in which there is no practical difference in meaning between the two forms. Let's consider three points:
Continuous/progressive forms "express the speaker's view of the event as having limited duration... Non-continuous forms express the speaker's view of the event a a complete, unitary whole"(Michael Lewis,The English Verb, 1986.97).
With perfect forms, the "fundamental meaning is that the speaker is looking back" (Lewis, p 97) over a period of time; the time period itself, if not the action, has duration and we know that duration is limited, because we know the end-point.
The semantic content of some verbs implies durativity, "the given situations lasts for a certain period of time", (Comrie, Aspect, 1976.41). The activity of working is inherently of much greater duration than that of, for example, coughing.
The past perfect (implying duration of time) progressive (implying duration of activity of the verb WORK (which is a durative activity) therefore shows three markers of duration. The non-progressive form shows two. It is possible to see the non-progressive form as implying duration less strongly but, in practical terms, "there appears to be a free choice" (Lewis, p 95).