Disclaimer : this is not answering the problem of remembering the user's choice, but this will help you in your process of informing your user nicely (better than an intrusive pop-up). If you manage to combine it with the second point of @WDUK 's answer (which I think is more appropriate to be an "accepted answer" than this one), you'll probably get something pretty good.
Have a look at Smart Banners.
It does not entirely solve your problem, but some of it.
If the user doesn't have the app installed on his device, the banner will appear with alink to your app on the AppStore. If the app is installed, clicking on the banner will open your app (you can have your app do something special if the user comes from the Smart Banner).
It does not solve your issue of having the banner "remember" if the user refused to install the app, but they really are "smart" and have some advantages.
Coming from Apple's documentation :
Users will trust that tapping the banner will
take them to the App Store and not a third-party advertisement. They
will appreciate that banners are presented unobtrusively at the top of
a webpage, instead of as a full-screen ad interrupting the web
content. And with a large and prominent close button, a banner is easy
for users to dismiss.
If the app is already installed on a user's device, the banner
intelligently changes its action, and tapping the banner will simply
open the app. If the user doesn’t have your app on his device, tapping
on the banner will take him to the app’s entry in the App Store. When
he returns to your website, a progress bar appears in the banner,
indicating how much longer the download will take to complete. When
the app finishes downloading, the View button changes to an Open
button, and tapping the banner will open the app while preserving the
user’s context from your website.
Smart App Banners automatically determine whether the app is supported
on the user’s device. If the device loading the banner does not
support your app, or if your app is not available in the user's
location, the banner will not display.