Like I said in my comment; this depends on how the page is referenced. If it's done from Apex code within the package itself, make sure to use PageReference pr = Page.PageName;
in favor of PageReference pr = new PageRefence('/apex/PageName');
The former automatically takes the namespace prefix into account.
If it's done from JavaScript however, it could get a little more complex. JS doesn't know anything about the namespace prefix, so you'd have to create an Apex function that returns the prefix and call that from JS to determine how you should set up your links. This questionThis question has some interesting stuff about how to get the namespace in JS.
To answer the question asked in the comments: If you have the name of the page (without the namespace prefix) and want to get a PageReference dynamically, you can use the ApexPage
sObject. Like so:
String pageName = 'MyPage';
ApexPage[] aps = [SELECT Id, NamespacePrefix, Name FROM ApexPage WHERE Name = :pageName];
String pageUrl = aps[0].NamespacePrefix != null ? aps[0].NamespacePrefix + '__' : '';
pageUrl += aps[0].Name;
PageReference pr = new PageReference(pageUrl);
Note that the query will return all pages with the same name, also ones with a different namespace prefix. So you should always make sure that the namespace prefix is one you expect.